package cn.com.tbshuda.websocket.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author: wsd
 * @date: 2021/5/11 10:54
 */
@Service
public class SendMessages {
    @Autowired
    private WebSocket webSocket;

    public void sendOneMessage(){
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
        webSocket.sendMessage("请求时间为："+sf.format(new Date()));
    }
}
